<template>
  <l-content-view :status="status" @init="init">
    <div class="handle-box">
      <el-button
        type="primary"
        icon="el-icon-delete"
        class="handle-del mr10"
        @click="delAllSelection"
      >批量删除</el-button>
      <el-select v-model="filter.address" placeholder="地址" class="handle-select mr10">
        <el-option key="1" label="广东省" value="广东省" />
        <el-option key="2" label="湖南省" value="湖南省" />
      </el-select>
      <el-input v-model="filter.name" placeholder="用户名" class="handle-input mr10" />
      <el-button type="primary" icon="el-icon-search" @click="doSearch">搜索</el-button>
    </div>
    <el-table
      ref="multipleTable"
      :data="tableData"
      border
      class="table"
      header-cell-class-name="table-header"
    >
      <el-table-column
        prop="id"
        label="ID"
        width="55"
        align="center"
      />
      <el-table-column prop="name" label="用户名" />
      <el-table-column label="账户余额">
        <template slot-scope="scope">￥{{ scope.row.money }}</template>
      </el-table-column>
      <el-table-column label="头像(查看大图)" align="center">
        <template slot-scope="scope">
          <el-image
            class="table-td-thumb"
            :src="scope.row.thumb"
            :preview-src-list="[scope.row.thumb]"
          />
        </template>
      </el-table-column>
      <el-table-column prop="address" label="地址" />
      <el-table-column label="状态" align="center">
        <template slot-scope="scope">
          <el-tag
            :type="scope.row.state==='成功'?'success':(scope.row.state==='失败'?'danger':'')"
          >{{ scope.row.state }}</el-tag>
        </template>
      </el-table-column>

      <el-table-column prop="date" label="注册时间" />
      <el-table-column label="操作" width="180" align="center">
        <template slot-scope="scope">
          <el-button
            type="text"
            icon="el-icon-edit"
            @click="handleEdit(scope.$index, scope.row)"
          >编辑</el-button>
          <el-button
            type="text"
            icon="el-icon-delete"
            class="red"
            @click="handleDelete(scope.$index, scope.row)"
          >删除</el-button>
        </template>
      </el-table-column>
    </el-table>
  </l-content-view>
</template>
<script>
import { PageStatus } from '@/config'
export default {
  data() {
    return {
      PageStatus,
      status: PageStatus.Ready,
      filter: {
        address: '',
        name: ''
      },
      tableData: []
    }
  },
  mounted() {
    console.log('-----collect Data mounted-----')
    // this.init();
  },
  methods: {
    init() {
      this.status = PageStatus.Loading
      setTimeout(() => {
        this.status = PageStatus.Ready
      }, 3000)
    },
    doSearch() {
      // 搜索数据
    },
    delAllSelection() {
      // 批量删除
    }
  }
}
</script>
<style lang="less" scoped>
.handle-box {
    margin-bottom: 20px;
}

.handle-select {
    width: 120px;
}

.handle-input {
    width: 300px;
    display: inline-block;
}

.mr10 {
    margin-right: 10px;
}
</style>
